﻿/**********************************天使物流*******************************************
* 功能描述:合同管理-货主合同
* 作者:石锦涛
* 时间:2022-01-07
* 
**********************************天使物流*******************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TianShiProject.Models.Common;
using TianShiProject.Models.Contract;
using TianShiProject.Models.Contract.NewOwnerContracts;
using Volo.Abp.Application.Services;

namespace TianShiProject.Contract.NewOwnerContracts
{
    public class NewOwnerApp: ApplicationService
    {
        private readonly INewOwnerAppRepository _newOwnerAppRepository;
        public NewOwnerApp(INewOwnerAppRepository newOwnerAppRepository)
        {
            _newOwnerAppRepository = newOwnerAppRepository;
        }

        /// <summary>
        /// 货主合同管理
        /// </summary>
        /// <returns></returns>
        public async Task<PageResponse<NewOwnerContractDtos>> GetNewOwners( string telet, string danwei, string principal, string operators, string dtime, int? state, int pageindex = 1, int pagesize = 5)
        {
            try
            {
               
                var list= await _newOwnerAppRepository.GetNewOwners( telet, danwei, principal, operators, dtime, state, pageindex, pagesize);
                return  list;
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 货主合同管理-逻辑删除
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public async Task<PageResponse<NewOwnerContract>> DeletePageDelet(int Id)
        {
            try
            {
                var list = await _newOwnerAppRepository.DeletePageDelet(Id);
                return list;
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 修改合同数据
        /// </summary>
        /// <param name="newOwner"></param>
        /// <returns></returns>
        public async Task<PageResponse<int>> UpdateNewOwner(NewOwnerContractDtos newOwner)
        {
            try
            {
                return await _newOwnerAppRepository.UpdateNewOwner(newOwner);
            }
            catch (Exception)
            {


                throw;
            }
        }

        /// <summary>
        /// 添加货主合同
        /// </summary>
        /// <param name="newOwner"></param>
        /// <returns></returns>
        public async Task<PageResponse<int>> Postsianjia(NewOwnerContract newOwner)
        {
            return await _newOwnerAppRepository.Postsianjia(newOwner);
        }

        /// <summary>
        /// 货主批量删除
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public async Task<PageResponse<NewOwnerContractDto>> DeletEmoreNewOwner(string Id)
        {
            try
            {
                return await _newOwnerAppRepository.DeletEmoreNewOwner(Id);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 货主跟踪是否发货
        /// </summary>
        /// <param name="newOwner"></param>
        /// <returns></returns>
        public async Task<PageResponse<int>> UpdateFahuoNewOwner(NewOwnerContractDtos newOwner)
        {
            try
            {
                return await _newOwnerAppRepository.UpdateFahuoNewOwner(newOwner);
            }
            catch (Exception)
            {


                throw;
            }
        }
        /// <summary>
        /// 货主跟踪是否签收
        /// </summary>
        /// <param name="newOwner"></param>
        /// <returns></returns>
        public async Task<PageResponse<int>> UpdateQianShoNewOwner(NewOwnerContractDtos newOwner)
        {
            try
            {
                return await _newOwnerAppRepository.UpdateQianShoNewOwner(newOwner);
            }
            catch (Exception)
            {


                throw;
            }
        }

    }
}
